package logic

import (
	"context"
	"good_srv/good"
	"good_srv/internal/svc"
	"good_srv/models"

	"github.com/zeromicro/go-zero/core/logx"
)

type PeopleListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewPeopleListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PeopleListLogic {
	return &PeopleListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 后台权限管理 角色 权限 表
func (l *PeopleListLogic) PeopleList(in *good.PeopleListRequest) (*good.PeopleListResponse, error) {
	// todo: add your logic here and delete this line
	var peoples models.People
	m, _ := peoples.PeopleList()
	var merchantlists []*good.PeopleList
	for _, i2 := range m {
		list := &good.PeopleList{
			Name:  i2.Name,
			Qname: i2.Qname,
		}
		merchantlists = append(merchantlists, list)
	}
	return &good.PeopleListResponse{
		List: merchantlists,
	}, nil
}
